#pragma once
#include <iostream>
#include <memory>
#include <mutex>
#include "yaml-cpp/yaml.h"

using namespace std;

class ConfigManager {
public:
	typedef std::shared_ptr<ConfigManager> Ptr_Cfg_Manager;

	~ConfigManager() {
		std::cout << "destructor configMamager!" << std::endl;
	}

	ConfigManager(ConfigManager&) = delete;
	ConfigManager& operator=(const ConfigManager&) = delete;

	static Ptr_Cfg_Manager getInstance() {
		if (p_instance_ptr == nullptr) {

			std::lock_guard<std::mutex> lk(m_mutex);

			if (p_instance_ptr == nullptr) {
				p_instance_ptr = std::shared_ptr<ConfigManager>(new ConfigManager);
			}
		}

		return p_instance_ptr;
	}


private:
	static std::mutex m_mutex;
	static Ptr_Cfg_Manager p_instance_ptr;

	ConfigManager() {
		std::cout << "construct configMamager!" << endl;
	};
};

class ConfigLoder {
public:
	~ConfigLoder() {
		std::cout << "destructor configLoder!" << std::endl;
	}

	ConfigLoder(const ConfigLoder&) = delete;
	ConfigLoder& operator=(const ConfigLoder&) = delete;

	static ConfigLoder& get_instance() {
		static ConfigLoder instance;
		return instance;
	}

	YAML::Node yaml_config_load(const string& filePath);

	void yaml_config_test(const string& filePath);
private:
	ConfigLoder() {
		std::cout << "construct configLoder!" << endl;
	};
};